import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;

class KeyListen implements KeyListener
{
	private TestGameState gs;
	
	public KeyListen(TestGameState gs)
	{
		this.gs = gs;
	}
	
	public void keyPressed(KeyEvent e)
	{
		int keyCode = e.getKeyCode();
		if(keyCode == KeyEvent.VK_W)
		{
			gs.getPlayer().setMoveUp(true);
		}
		if(keyCode == KeyEvent.VK_S)
		{
			gs.getPlayer().setMoveDown(true);
		}
		if(keyCode == KeyEvent.VK_D)
		{
			gs.getPlayer().setMoveRight(true);
		}
		if(keyCode == KeyEvent.VK_A)
		{
			gs.getPlayer().setMoveLeft(true);
		}
	}
	
	public void keyReleased(KeyEvent e)
	{
		int keyCode = e.getKeyCode();
		if(keyCode == e.VK_W)
		{
			gs.getPlayer().setMoveUp(false);
		}
		if(keyCode == e.VK_S)
		{
			gs.getPlayer().setMoveDown(false);
		}
		if(keyCode == e.VK_D)
		{
			gs.getPlayer().setMoveRight(false);
		}
		if(keyCode == e.VK_A)
		{
			gs.getPlayer().setMoveLeft(false);
		}
	}
	public void keyTyped(KeyEvent e){}
}